import type {
  MidtermDefenseAddDTOType,
  MidtermDefenseUpdateDTOType,
  MidtermDefenseSearchDTOType, MidtermDefenseAuditDTOType
} from '@/resources/interface/midtermDefense/MidtermDefenseTypes'
import type { ResultTypes } from '@/resources/interface/ResultTypes'
import { HttpResultUtil } from '@/apis/utils/HttpResultUtil'

export class MidtermDefenseApi {
  private static addUrl: string = '/midtermDefense/add'
  private static updateUrl: string = '/midtermDefense/update'
  private static searchUrl: string = '/midtermDefense/search'
  private static deleteUrl: string = '/midtermDefense/delete'
  private static auditUrl: string = '/midtermDefense/audit'

  static audit(data: MidtermDefenseAuditDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.auditUrl, data,true)
  }
  static add(data: MidtermDefenseAddDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.addUrl, data,true)
  }

  static update(data: MidtermDefenseUpdateDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.updateUrl, data,true)
  }

  static search(data: MidtermDefenseSearchDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.searchUrl, data,false)
  }

  static delete(idList: Array<number>): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.deleteUrl, idList,true)
  }
}
